/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package young;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;
import javax.swing.Timer;
import org.generation5.Steppable;
import org.generation5.Visualizable;
import org.generation5.swing.VisStepListener;
import org.generation5.swing.VisualizationPanel;

/**
 *
 * @author pablovlez
 */
public class YoungGUI extends javax.swing.JFrame implements ActionListener {

    /**
     * Creates new form NewJFrame
     */
    public Young young;
    public int n = 50;
    public int timerInterval = 40;
    public double percent = 0.95;

    public YoungGUI() {
        initComponents();
        visualizationPanel = new org.generation5.swing.VisualizationPanel();
        visualizationPanel.addMouseListener(new java.awt.event.MouseAdapter() {

            public void mouseClicked(java.awt.event.MouseEvent evt) {
                visualizationPanelMouseClicked(evt);
            }
        });


        allowMouseInteraction = !(false);
        // Set the timer interval according to the maximum FPS
        timerInterval = 1000 / 25; //getIntParameter("MaxFPS", 25);
        // Should the timer start immediately?
        isRunning = false;//getBoolParameter("Autostart", false);
        // Get the background colour, this is used for the toolbar, as well as classes.
        //clrBackground = new Color(getIntParameter("BackgroundColor", 0xdfdfdf, 16));
        clrBackground = Color.BLUE;
        // Set the animation timer

        animTimer = new Timer(timerInterval, this);
        animTimer.setInitialDelay(0);
        animTimer.setCoalesce(true);

        visualizationPanel.setAntiAliasing(false);

        //Instanciamos el objeto young
        young = new Young(n, n, 2.30, 6.01, 1, -0.34);
        //Pasamos el objeto a las clases Visualizable y Steppable
        setSteppable(young);
        setVisualizable(young);
        jpnVisualizar.add(visualizationPanel, java.awt.BorderLayout.CENTER);
        jsN.setValue(n);
        txtR1.setText("2.30");
        txtR2.setText("6.01");
        txtW1.setText("1");
        txtW2.setText("-0.34");

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jpnBotones = new javax.swing.JPanel();
        btnParar = new javax.swing.JButton();
        btnPaso = new javax.swing.JButton();
        btnIniciar = new javax.swing.JButton();
        jpnDatos = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        txtR1 = new javax.swing.JTextField();
        txtR2 = new javax.swing.JTextField();
        txtW1 = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        txtW2 = new javax.swing.JTextField();
        btnAceptar = new javax.swing.JButton();
        jsTamanio = new javax.swing.JSlider();
        btnModificar = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jsN = new javax.swing.JSlider();
        jLabel7 = new javax.swing.JLabel();
        jsPercent = new javax.swing.JSlider();
        jpnVisualizar = new javax.swing.JPanel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Modelos de Manchas y Patrones Young");

        jPanel1.setLayout(null);

        jpnBotones.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Controles"));
        jpnBotones.setLayout(null);

        btnParar.setText("Reiniciar");
        btnParar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPararActionPerformed(evt);
            }
        });
        jpnBotones.add(btnParar);
        btnParar.setBounds(228, 35, 96, 23);

        btnPaso.setText("Paso");
        btnPaso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPasoActionPerformed(evt);
            }
        });
        jpnBotones.add(btnPaso);
        btnPaso.setBounds(128, 35, 88, 23);

        btnIniciar.setText("Iniciar");
        btnIniciar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnIniciarActionPerformed(evt);
            }
        });
        jpnBotones.add(btnIniciar);
        btnIniciar.setBounds(16, 35, 102, 23);

        jPanel1.add(jpnBotones);
        jpnBotones.setBounds(290, 560, 340, 90);

        jpnDatos.setBorder(javax.swing.BorderFactory.createTitledBorder("Parametros"));
        jpnDatos.setLayout(null);

        jLabel1.setText("R1");
        jpnDatos.add(jLabel1);
        jLabel1.setBounds(20, 200, 30, 14);

        jLabel2.setText("R2");
        jpnDatos.add(jLabel2);
        jLabel2.setBounds(20, 240, 30, 14);

        jLabel3.setText("w1");
        jpnDatos.add(jLabel3);
        jLabel3.setBounds(20, 280, 30, 14);

        txtR1.setEnabled(false);
        jpnDatos.add(txtR1);
        txtR1.setBounds(60, 200, 60, 30);

        txtR2.setEnabled(false);
        jpnDatos.add(txtR2);
        txtR2.setBounds(60, 240, 60, 30);

        txtW1.setEnabled(false);
        jpnDatos.add(txtW1);
        txtW1.setBounds(60, 280, 60, 30);

        jLabel4.setText("w2");
        jpnDatos.add(jLabel4);
        jLabel4.setBounds(20, 320, 30, 14);

        txtW2.setEnabled(false);
        jpnDatos.add(txtW2);
        txtW2.setBounds(60, 320, 60, 30);

        btnAceptar.setText("Aceptar");
        btnAceptar.setEnabled(false);
        btnAceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAceptarActionPerformed(evt);
            }
        });
        jpnDatos.add(btnAceptar);
        btnAceptar.setBounds(110, 460, 90, 23);

        jsTamanio.setMajorTickSpacing(2);
        jsTamanio.setMaximum(10);
        jsTamanio.setMinorTickSpacing(1);
        jsTamanio.setPaintLabels(true);
        jsTamanio.setPaintTicks(true);
        jsTamanio.setEnabled(false);
        jsTamanio.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jsTamanioStateChanged(evt);
            }
        });
        jpnDatos.add(jsTamanio);
        jsTamanio.setBounds(20, 380, 140, 50);

        btnModificar.setText("Modificar");
        btnModificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnModificarActionPerformed(evt);
            }
        });
        jpnDatos.add(btnModificar);
        btnModificar.setBounds(10, 460, 80, 23);

        jLabel5.setText("Zoom");
        jpnDatos.add(jLabel5);
        jLabel5.setBounds(20, 360, 80, 14);

        jLabel6.setText("Tamanio Mundo");
        jpnDatos.add(jLabel6);
        jLabel6.setBounds(20, 30, 90, 14);

        jsN.setMajorTickSpacing(20);
        jsN.setMinorTickSpacing(10);
        jsN.setPaintLabels(true);
        jsN.setPaintTicks(true);
        jsN.setEnabled(false);
        jsN.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jsNStateChanged(evt);
            }
        });
        jpnDatos.add(jsN);
        jsN.setBounds(30, 50, 150, 50);

        jLabel7.setText("% Poblacion Inicial");
        jpnDatos.add(jLabel7);
        jLabel7.setBounds(20, 110, 110, 14);

        jsPercent.setMajorTickSpacing(20);
        jsPercent.setMinorTickSpacing(10);
        jsPercent.setPaintLabels(true);
        jsPercent.setPaintTicks(true);
        jsPercent.setEnabled(false);
        jsPercent.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jsPercentStateChanged(evt);
            }
        });
        jpnDatos.add(jsPercent);
        jsPercent.setBounds(30, 130, 150, 50);

        jPanel1.add(jpnDatos);
        jpnDatos.setBounds(20, 40, 210, 510);

        jpnVisualizar.setLayout(new java.awt.BorderLayout());
        jPanel1.add(jpnVisualizar);
        jpnVisualizar.setBounds(250, 40, 520, 510);

        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);

        jMenu1.setText("Archivo");

        jMenuItem1.setText("Salir");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem1);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Ayuda");

        jMenuItem3.setText("Patrones");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem3);

        jMenuItem2.setText("Acerca de");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem2);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-842)/2, (screenSize.height-719)/2, 842, 719);
    }// </editor-fold>//GEN-END:initComponents

    private void btnIniciarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnIniciarActionPerformed
        // TODO add your handling code here:
        actions.startButton(evt);
    }//GEN-LAST:event_btnIniciarActionPerformed

    private void btnPasoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPasoActionPerformed
        // TODO add your handling code here:
        actions.stepButton(evt);
    }//GEN-LAST:event_btnPasoActionPerformed

    private void btnPararActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPararActionPerformed
        // TODO add your handling code here:
        actions.resetButton(evt);
    }//GEN-LAST:event_btnPararActionPerformed

    private void btnAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAceptarActionPerformed
        // TODO add your handling code here:

        //obtenemos los datos de parametros
        double _R1 = Double.parseDouble(txtR1.getText());
        double _R2 = Double.parseDouble(txtR2.getText());
        double _w1 = Double.parseDouble(txtW1.getText());
        double _w2 = Double.parseDouble(txtW2.getText());
        n = jsN.getValue();
        percent = jsPercent.getValue();
        percent /= 100;
        jsTamanio.setMaximum(500 / n);
        //------
        //Creamos el nuevo objeto
        young = new Young(n, _R1, _R2, _w1, _w2, percent);
        //Incializamos el mundo y repintamos el panelVisualizacion
        young.init();
        young.setCASize(jsTamanio.getValue());
        setSteppable(young);
        setVisualizable(young);
        this.repaint();
        //deshabilitamos parametros
        habilitarParametros(false);

    }//GEN-LAST:event_btnAceptarActionPerformed

    private void jsTamanioStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jsTamanioStateChanged
        // Accion que se ejecuta cuando el jSlider Zoom cambia de valor
        //Obtiene el valor del jSlider y se cambia el tamanio del zoom
        young.setCASize(jsTamanio.getValue());
        setSteppable(young);
        setVisualizable(young);
        this.repaint();
    }//GEN-LAST:event_jsTamanioStateChanged

    private void visualizationPanelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_visualizationPanelMouseClicked
        actions.mouseClicked(evt);
    }//GEN-LAST:event_visualizationPanelMouseClicked

    private void btnModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnModificarActionPerformed
        // TODO add your handling code here:
        habilitarParametros(true);
    }//GEN-LAST:event_btnModificarActionPerformed

    private void jsNStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jsNStateChanged
        // Accion que se ejecuta cuando el jSlider Tamanio Mundo cambia de valor     

        //Obtenemos el valor del jSlider tamanio Poblacion 
        n = jsN.getValue();
        //Se lo pasamos al objeto young para redimensionar el mundo
        young.setWorldSize(n, n);
        percent = jsPercent.getValue();
        percent /= 100;
        //le pasamos el porcentaje de automatas en estado 1
        young.setPercent(percent);

        //reajustamos el jSlider del zoom para cuando cambia el numero del tamanio de poblacion
        if (n > 1) {
            jsTamanio.setMaximum(500 / n);
        } else {
            jsTamanio.setMaximum(500);
        }
        young.init();
        setSteppable(young);
        setVisualizable(young);
        this.repaint();

    }//GEN-LAST:event_jsNStateChanged

    private void jsPercentStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jsPercentStateChanged
        // Accion que se ejecuta cuando el jSlider % Poblacion Inicial cambia de valor

        //le pasamos el porcentaje de automatas en estado 1
        percent = jsPercent.getValue();
        percent /= 100;
        young.setPercent(percent);
        young.init();
        setSteppable(young);
        setVisualizable(young);
        repaint();

    }//GEN-LAST:event_jsPercentStateChanged

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
        dispose();
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        // TODO add your handling code here:
        JTextArea info = new JTextArea();
        String text = "Modelo de Manchas y Bandas en la piel de Animales Young \n\n"
                + "Parametros:\n\n"
                + "Tamanio Mundo: Es la dimension de la cuadricula\n"
                + "% Poblacion Inicial: Porcentaje de automatas en estado 1\n"
                + "R1 : Radio de activacion (un automata pasa de estado 0 a estado 1)\n"
                + "R2 : Radio de inhibicion (un automata pasa de estado 1 a estado 0)\n"
                + "w1 : Intensidad de activacion dentro de R1\n"
                + "w2 : Intensidad de inhibicion dentro de R2\n"
                + "Zoom: Acercar o alejar la cuadricula\n\n"
                + "Controles: \n"
                + "Inciar : Incia la simulacion\n"
                + "Paso : Muestra paso a paso la simulacion\n"
                + "Reinciar : Reincia la simulacion\n\n"
                + "Para mas detalle y ver las reglas de transicion consultar\n"
                + "Rafael Lahoz-Beltra, Bioinformatica: Simulacion, Vida Articial e Inteligencia Artificial, pag. 175\n\n"
                + "Autor:\n\n"
                + "Pablo Andres Velez Arias\n"
                + "Vida Artificial\n"
                + "Ingenieria en Sistemas\n"
                + "Universidad del Valle";
        info.setText(text);
        JOptionPane.showMessageDialog(this, info);

    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        // TODO add your handling code here:

        JTextArea info = new JTextArea();
        String text = "Modelo de Manchas y Bandas en la piel de Animales Young \n\n"
                + "Patrones:\n\n"
                + "Los experimentos de simulacion realizados por Young \n"
                + "definen los valores:\n\n"
                + "R1 : 2.30 \n"
                + "R2 : 6.01 \n"
                + "w1 : 1 \n"
                + "w2 : -0.20 o -0.34 (manchas para el primero, bandas para el segundo)\n\n"
                + "El tipo de patron depende unicamente del grado de inhibicion (w2)";
        info.setText(text);
        JOptionPane.showMessageDialog(this, info);

    }//GEN-LAST:event_jMenuItem3ActionPerformed

    public void habilitarParametros(boolean value) {
        txtR1.setEnabled(value);
        txtR2.setEnabled(value);
        txtW1.setEnabled(value);
        txtW2.setEnabled(value);
        jsN.setEnabled(value);
        jsPercent.setEnabled(value);
        jsTamanio.setEnabled(value);
        btnAceptar.setEnabled(value);
        btnModificar.setEnabled(!value);
    }

    /**
     * Set the steppable data.
     *
     * @param step the steppable data.
     */
    public void setSteppable(Steppable step) {
        steppable = step;
        if (steppable == null) {
            btnIniciar.setEnabled(false);
            btnPaso.setEnabled(false);
            btnParar.setEnabled(false);
        } else {
            btnIniciar.setEnabled(true);
            btnPaso.setEnabled(true);
            btnParar.setEnabled(true);
        }
    }

    /**
     * Set the visualizable data.
     *
     * @param viz the visualizable data.
     */
    public void setVisualizable(Visualizable viz) {
        visualizable = viz;
        if (visualizable == null) {
            visualizationPanel.setContent(new NullVisualizable());
        } else {
            visualizationPanel.setContent(viz);
        }
    }

    public void setStartStop(boolean runningNow) {
        if (runningNow) {
            btnIniciar.setForeground(new Color(192, 0, 0));
            btnIniciar.setText("Detener");
            if (!animTimer.isRunning()) {
                animTimer.start();
            }
        } else {
            btnIniciar.setForeground(new Color(0, 192, 0));
            btnIniciar.setText("Iniciar");
            if (animTimer.isRunning()) {
                animTimer.stop();
            }
        }

        isRunning = runningNow;
    }

    /**
     * Called when the animation timer is triggered. Advances the
     * <code>Steppable</code> class, and repaints the VisualizationPanel.
     *
     * @param e not used.
     */
    public void actionPerformed(ActionEvent e) {
        actions.timer(e);
    }
    // Variables declaration - do not modify                     
    protected VisualizationPanel visualizationPanel;
    // End of variables declaration                   
    /**
     * Denotes whether the applet is running. This is controlled by an animation
     * timer.
     */
    protected boolean isRunning;
    /**
     * Denotes whether the applet allows for mouse interaction. This is
     * automatically set if the toolbar is hidden. A double-click starts or
     * stops the applet, a right- click will advance the demonstration one
     * timestep.
     */
    protected boolean allowMouseInteraction;
    /**
     * The animation/control timer. The timer will fire the desired number of
     * frames per second, calling both the doStep method and the repaint method
     * of the visualization panel.
     *
     * @see Steppable#doStep
     */
    protected Timer animTimer;
    /**
     * The background color. This is used as the background of the toolbar and
     * the visualization panel.
     */
    protected Color clrBackground;
    /**
     * The steppable content.
     */
    protected Steppable steppable = null;
    /**
     * The visualizable content.
     */
    protected Visualizable visualizable = new NullVisualizable();
    /**
     * The actions for this applet for the start, step, reset and timer actions.
     */
    protected VisStepListener actions = new DefaultActions();

    /**
     * This class is the default visualization.
     */
    protected class NullVisualizable implements Visualizable {

        /**
         * Renders basic visualization.
         *
         * @param g the graphics context.
         * @param width the context width.
         * @param height the context height.
         */
        public void render(java.awt.Graphics g, int width, int height) {
            Graphics2D g2d = (Graphics2D) g;
            g2d.setColor(new Color(192, 0, 0));
            g2d.drawLine(0, 0, width, height);
            g2d.drawLine(width, 0, 0, height);
            g2d.setColor(Color.BLACK);
            g2d.drawString("No visualizable data", width / 2 - 48, height / 2 + 4);
        }

        /**
         * Not implemented.
         *
         * @param s the filename.
         * @param width the image width.
         * @param height the image height.
         */
        public void writeImage(String s, int width, int height) {
            return;
        }
    }

    /**
     * These are the default actions for
     * <code>VisStepApplets</code>.
     */
    protected class DefaultActions implements VisStepListener {

        /**
         * Start the timer.
         *
         * @param evt an action event.
         */
        public void startButton(java.awt.event.ActionEvent evt) {
            setStartStop(!isRunning);
        }

        /**
         * Stop the timer, and advance the Steppable one timestep using
         * <code>doStep</code>.
         *
         * @param evt an actiob event.
         */
        public void stepButton(java.awt.event.ActionEvent evt) {
            setStartStop(false);
            if (steppable != null) {
                steppable.doStep();
            }
            visualizationPanel.repaint();
        }

        /**
         * Stop the timer and run the Steppable's
         * <code>reset</code> method.
         *
         * @param evt an action event.
         */
        public void resetButton(java.awt.event.ActionEvent evt) {
            setStartStop(false);
            if (steppable != null) {
                steppable.reset();
            }

            visualizationPanel.repaint();
        }

        /**
         * Advances the applet by one timestep, calling
         * <code>doStep</code> and repainting the visualization panel.
         *
         * @param evt an action event.
         */
        public void timer(java.awt.event.ActionEvent evt) {
            if (steppable != null) {
                steppable.doStep();
            }

            visualizationPanel.repaint();
        }

        /**
         * No default action for mouse clicks.
         *
         * @param evt a mouse event.
         */
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            if (allowMouseInteraction) {
                if (evt.getButton() == evt.BUTTON1) {
                    if (evt.getClickCount() == 2) {
                        btnIniciarActionPerformed(null);
                    }
                } else if (evt.getButton() == evt.BUTTON3 && !isRunning) {
                    btnPasoActionPerformed(null);
                }
            }
        }
    }

    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {

                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    //System.out.println(info.getName());
                    break;
                }

            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(YoungGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(YoungGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(YoungGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(YoungGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new YoungGUI().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAceptar;
    private javax.swing.JButton btnIniciar;
    private javax.swing.JButton btnModificar;
    private javax.swing.JButton btnParar;
    private javax.swing.JButton btnPaso;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jpnBotones;
    private javax.swing.JPanel jpnDatos;
    private javax.swing.JPanel jpnVisualizar;
    private javax.swing.JSlider jsN;
    private javax.swing.JSlider jsPercent;
    private javax.swing.JSlider jsTamanio;
    private javax.swing.JTextField txtR1;
    private javax.swing.JTextField txtR2;
    private javax.swing.JTextField txtW1;
    private javax.swing.JTextField txtW2;
    // End of variables declaration//GEN-END:variables
}
